function  half_life = calculate_half_life( x, dt )
% Usage: the input x is a vector of the path, with crisis starting date as
% zero. Then the path declines, and recovers.   dt is the time unit used
% for the vector x
crisis_starting = find(x==0);
crisis_starting = crisis_starting(1);
[~, index_min] = min(x);

x_effective = x( index_min:end );
[ ~, index ] = min(  abs( x_effective - 0.5*min(x_effective)  )  );
half_life = (index + index_min-1  - crisis_starting) * dt;



